<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script>
		<title>学生界面</title>
		<style type="text/css">
			.Student_Home_div {
				float: left;
				width: 50%;
			}
		</style>
		<script type="text/javascript">
			function downloadPaper() {
				document.getElementById("btn_file").click();
				document.getElementById("downloadPaperName").value = document.getElementById("btn_file").value;
			}

			function uploadPaper() {
				document.getElementById("btn_file").click();
				document.getElementById("uploadPaperName").value = document.getElementById("btn_file").value;
			}
		</script>
	</head>
	<jsp:include page="Student_header.jsp"></jsp:include>
	<body>
		<header><p>考试名称：</p><p id="examName"></p></header>
		<div>
			<div class="Student_Home_div">
				<header>试卷下载：</header>
				<form action="StudentServlet" method="get">
					<input type="hidden" name="method" value="getExamFile" />
					<input type="submit" value="点击下载" />
				</form>
			</div>
			<div class="Student_Home_div">
				<header>答案上传</header>
				<form action="StudentServlet" method="post" enctype="multipart/form-data">
					<input type="hidden" name="method" value="postExamFile" />
					<input type="file" name="shijuan" />
					<input type="submit" value="提交试卷" />
				</form>
			</div>
		</div>

	</body>
	<script>
		$(function(){
			getExamName();
		})
		
		function getExamName(){
			$.ajax({
				url : "${pageContext.request.contextPath}/StudentServlet",
				type : "GET",
				data : {"method":"getExamName"},
				success : function(data) {
					$("#examName").html(data);
				},
				error : function() {
					alert('获取考试名称失败！');
				}
			});
		}
	</script>
</html>
